package think.thread.sychron.c02.pipe;

import java.io.PipedWriter;
import java.util.Random;
import java.util.concurrent.TimeUnit;

public class Sender implements Runnable{
	
	private PipedWriter writer=new PipedWriter();
	private Random rand=new Random();
	public PipedWriter getWriter(){
		return writer;
	}
	public void run() {
		try {
			for(char c='a';c<='z';c++){
				writer.write(c);
				TimeUnit.MILLISECONDS.sleep(rand.nextInt(100));
			}
			System.out.println("send over");
		} catch (Exception e) {
			
		}
		
	}
	
}
